FROM golang:1.20-alpine3.17 as build

RUN apk update
RUN apk add make

ADD . /build/src
WORKDIR /build/src
#RUN make install-dep
RUN go install github.com/rakyll/statik@latest
RUN make build

# deployment image
FROM alpine:3.17.2
WORKDIR /app

COPY --from=build /build/src/bin/config.json /app/config.json
COPY --from=build /build/src/bin/lwnsimulator /app/lwnsimulator

COPY docker ./

EXPOSE 8000
EXPOSE 8001

ENV SIM_BRIDGE_HOST 172.17.0.1
ENV SIM_BRIDGE_PORT 1700

ENV GTW_NAME VirtualGateway
ENV GTW_MAC_ADDRESS 0000000000000001

ENV DEV_NAME VirtualSensor
ENV DEV_EUI 0000000000000001
ENV DEV_ADDR 00000001
ENV DEV_APP_KEY 00000000000000000000000000000001
ENV DEV_NWK_SKEY 00000000000000000000000000000010
ENV DEV_APP_SKEY 00000000000000000000000000000100
ENV DEV_MYTYPE ConfirmedDataUp
ENV DEV_PAYLOAD hello
ENV DEV_PAYLOAD_BASE64 false
ENV DEV_ALIGN_CURRENT_TIME false
ENV DEV_INFO_UPLINK_FPORT 2
ENV DEV_REGION EU868
ENV DEV_CONF_DATARATE 0
ENV DEV_SENDINTERVAL 60
ENV DEV_ACKTIMEOUT 2
ENV DEV_CONF_RSSI -60

ENV DEV_RXS0_FREQUPLINK 868100000
ENV DEV_RXS0_FREQDOWNLINK 868100000
ENV DEV_RXS0_MINDR 0
ENV DEV_RXS0_MAXDR 5
ENV DEV_RXS0_DATARATE 0
ENV DEV_RXS1_FREQUPLINK 0
ENV DEV_RXS1_FREQDOWNLINK 869525000
ENV DEV_RXS1_MINDR 0
ENV DEV_RXS1_MAXDR 0
ENV DEV_RXS1_DATARATE 0

ENTRYPOINT [ "./entrypoint.sh" ]